import numpy as np
from sklearn.decomposition import PCA
from sklearn import preprocessing

# df = np.array([2.5, 2.4, 0.5, 0.7, 2.2, 2.9, 1.9, 2.2, 3.1, 3.0, 2.3, 2.7, 2, 1.6, 1, 1.1, 1.5, 1.6, 1.1, 0.9], (10, 2))
arr = input("")
data = [float(n) for n in arr.split(",")]
l_c = input()
line_column = [int(n) for n in l_c.split(",")]
df = np.array(np.zeros((line_column[0], line_column[1]), dtype=float))
i = 0
for line in range(0, line_column[0]):
    for col in range(0, line_column[1]):
        df[line][col] = data[i]
        i = i + 1

x = (df - np.mean(df)) / np.std(df)
x1 = np.cov(x.T)
w, v = np.linalg.eig(x1)
if w[0] > w[1]:
    index = 0
else:
    index = 1
print("第1主成分={:.5f}*(x1-{:.2f}){:+.5f}*(x2-{:.2f})".format(v[0][index], np.mean(df, axis=0)[0], v[1]
[index], np.mean(df, axis=0)[1]))


